<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>模型管理 - 智能制造分析系统</title>

  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="../../assets/css/all.min.css">
  <!-- AdminLTE -->
  <link rel="stylesheet" href="../../assets/css/adminlte.min.css">
  <!-- Select2 -->
  <link rel="stylesheet" href="../../assets/css/select2.min.css">
  <link rel="stylesheet" href="../../assets/css/select2-bootstrap4.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" href="../../assets/css/dataTables.bootstrap4.min.css">
  <!-- Chart.js -->
  <link rel="stylesheet" href="../../assets/css/chart.min.css">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  <!-- Navbar -->
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
    </ul>

    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
      <li class="nav-item">
        <a class="nav-link" data-widget="fullscreen" href="#" role="button">
          <i class="fas fa-expand-arrows-alt"></i>
        </a>
      </li>
    </ul>
  </nav>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
  <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="../../index.html" class="brand-link">
      <img src="../../assets/img/AdminLTELogo.png" alt="Logo" class="brand-image img-circle elevation-3" style="opacity: .8">
      <span class="brand-text font-weight-light">智能制造分析系统</span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
          <li class="nav-item">
            <a href="../dashboard.html" class="nav-link">
              <i class="nav-icon fas fa-tachometer-alt"></i>
              <p>生产监控</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="../yield-analysis.html" class="nav-link">
              <i class="nav-icon fas fa-chart-line"></i>
              <p>良率分析</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="../equipment-maintenance.html" class="nav-link">
              <i class="nav-icon fas fa-cogs"></i>
              <p>设备维护</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="../data-source.html" class="nav-link">
              <i class="nav-icon fas fa-database"></i>
              <p>数据源配置</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="../system-settings.html" class="nav-link">
              <i class="nav-icon fas fa-cog"></i>
              <p>系统设置</p>
            </a>
          </li>
          <li class="nav-header">AI功能</li>
          <li class="nav-item">
            <a href="model-management.html" class="nav-link active">
              <i class="nav-icon fas fa-brain"></i>
              <p>模型管理</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="prediction-analysis.html" class="nav-link">
              <i class="nav-icon fas fa-chart-bar"></i>
              <p>预测分析</p>
            </a>
          </li>
        </ul>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>AI模型管理</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">首页</a></li>
              <li class="breadcrumb-item active">AI模型管理</li>
            </ol>
          </div>
        </div>
      </div>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <!-- 模型概览 -->
        <div class="row">
          <div class="col-lg-3 col-6">
            <div class="small-box bg-info">
              <div class="inner">
                <h3>12</h3>
                <p>模型总数</p>
              </div>
              <div class="icon">
                <i class="fas fa-brain"></i>
              </div>
              <a href="#" class="small-box-footer">
                更多信息 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-success">
              <div class="inner">
                <h3>8</h3>
                <p>运行中模型</p>
              </div>
              <div class="icon">
                <i class="fas fa-play"></i>
              </div>
              <a href="#" class="small-box-footer">
                更多信息 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-warning">
              <div class="inner">
                <h3>3</h3>
                <p>待更新模型</p>
              </div>
              <div class="icon">
                <i class="fas fa-sync"></i>
              </div>
              <a href="#" class="small-box-footer">
                查看详情 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-danger">
              <div class="inner">
                <h3>1</h3>
                <p>异常模型</p>
              </div>
              <div class="icon">
                <i class="fas fa-exclamation-triangle"></i>
              </div>
              <a href="#" class="small-box-footer">
                查看详情 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
        </div>

        <!-- 模型列表 -->
        <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">模型列表</h3>
                <div class="card-tools">
                  <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#addModelModal">
                    <i class="fas fa-plus"></i> 添加模型
                  </button>
                </div>
              </div>
              <div class="card-body">
                <table id="modelTable" class="table table-bordered table-striped">
                  <thead>
                    <tr>
                      <th>模型名称</th>
                      <th>类型</th>
                      <th>版本</th>
                      <th>状态</th>
                      <th>准确率</th>
                      <th>最后更新</th>
                      <th>操作</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>良率预测模型</td>
                      <td>回归</td>
                      <td>v2.1.0</td>
                      <td><span class="badge badge-success">运行中</span></td>
                      <td>95.8%</td>
                      <td>2024-02-20</td>
                      <td>
                        <button class="btn btn-info btn-sm"><i class="fas fa-edit"></i></button>
                        <button class="btn btn-warning btn-sm"><i class="fas fa-sync"></i></button>
                        <button class="btn btn-danger btn-sm"><i class="fas fa-trash"></i></button>
                      </td>
                    </tr>
                    <tr>
                      <td>设备故障预测</td>
                      <td>分类</td>
                      <td>v1.5.0</td>
                      <td><span class="badge badge-success">运行中</span></td>
                      <td>92.3%</td>
                      <td>2024-02-19</td>
                      <td>
                        <button class="btn btn-info btn-sm"><i class="fas fa-edit"></i></button>
                        <button class="btn btn-warning btn-sm"><i class="fas fa-sync"></i></button>
                        <button class="btn btn-danger btn-sm"><i class="fas fa-trash"></i></button>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>

        <!-- 模型性能监控 -->
        <div class="row">
          <div class="col-md-6">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">模型性能趋势</h3>
              </div>
              <div class="card-body">
                <canvas id="modelPerformanceChart" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas>
              </div>
            </div>
          </div>
          <div class="col-md-6">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">模型资源使用</h3>
              </div>
              <div class="card-body">
                <canvas id="modelResourceChart" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas>
              </div>
            </div>
          </div>
        </div>

        <!-- 模型版本历史 -->
        <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">模型版本历史</h3>
                <div class="card-tools">
                  <button type="button" class="btn btn-tool" data-card-widget="collapse">
                    <i class="fas fa-minus"></i>
                  </button>
                </div>
              </div>
              <div class="card-body">
                <div class="table-responsive">
                  <table class="table table-bordered">
                    <thead>
                      <tr>
                        <th>模型名称</th>
                        <th>版本</th>
                        <th>更新内容</th>
                        <th>准确率</th>
                        <th>更新时间</th>
                        <th>操作</th>
                      </tr>
                    </thead>
                    <tbody>
                      <tr>
                        <td>良率预测模型</td>
                        <td>v2.1.0</td>
                        <td>优化特征工程，提升预测准确率</td>
                        <td>95.8%</td>
                        <td>2024-03-15 15:30:00</td>
                        <td>
                          <button type="button" class="btn btn-info btn-sm">
                            <i class="fas fa-history"></i> 查看详情
                          </button>
                        </td>
                      </tr>
                      <tr>
                        <td>良率预测模型</td>
                        <td>v2.0.0</td>
                        <td>引入深度学习模型，支持多维度预测</td>
                        <td>94.5%</td>
                        <td>2024-03-01 10:20:00</td>
                        <td>
                          <button type="button" class="btn btn-info btn-sm">
                            <i class="fas fa-history"></i> 查看详情
                          </button>
                        </td>
                      </tr>
                      <tr>
                        <td>良率预测模型</td>
                        <td>v1.0.0</td>
                        <td>初始版本发布</td>
                        <td>92.0%</td>
                        <td>2024-02-15 09:15:00</td>
                        <td>
                          <button type="button" class="btn btn-info btn-sm">
                            <i class="fas fa-history"></i> 查看详情
                          </button>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>

  <!-- 添加模型模态框 -->
  <div class="modal fade" id="addModelModal">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <h4 class="modal-title">添加模型</h4>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
          <form>
            <div class="form-group">
              <label>模型名称</label>
              <input type="text" class="form-control" placeholder="请输入模型名称">
            </div>
            <div class="form-group">
              <label>模型类型</label>
              <select class="form-control select2" style="width: 100%;">
                <option>回归</option>
                <option>分类</option>
                <option>聚类</option>
              </select>
            </div>
            <div class="form-group">
              <label>模型文件</label>
              <div class="input-group">
                <div class="custom-file">
                  <input type="file" class="custom-file-input" id="modelFile">
                  <label class="custom-file-label" for="modelFile">选择文件</label>
                </div>
              </div>
            </div>
            <div class="form-group">
              <label>描述</label>
              <textarea class="form-control" rows="3" placeholder="请输入模型描述"></textarea>
            </div>
          </form>
        </div>
        <div class="modal-footer justify-content-between">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <button type="button" class="btn btn-primary">保存</button>
        </div>
      </div>
    </div>
  </div>

  <!-- Main Footer -->
  <footer class="main-footer">
    <div class="float-right d-none d-sm-block">
      <b>Version</b> 1.0.0
    </div>
    <strong>Copyright &copy; 2024 <a href="#">智能制造分析系统</a>.</strong> All rights reserved.
  </footer>
</div>

<!-- jQuery -->
<script src="../../assets/js/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../../assets/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="../../assets/js/adminlte.min.js"></script>
<!-- Select2 -->
<script src="../../assets/js/select2.min.js"></script>
<!-- DataTables -->
<script src="../../assets/js/jquery.dataTables.min.js"></script>
<script src="../../assets/js/dataTables.bootstrap4.min.js"></script>
<!-- Chart.js -->
<script src="../../assets/js/chart.min.js"></script>
<!-- daterangepicker -->
<script src="../../assets/js/daterangepicker.min.js"></script>
<link rel="stylesheet" href="../../assets/css/daterangepicker.css">

<script>
  $(function () {
    // 初始化Select2
    $('.select2').select2({
      theme: 'bootstrap4'
    });

    // 初始化DataTable
    $('#modelTable').DataTable({
      "paging": true,
      "lengthChange": true,
      "searching": true,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "responsive": true,
      "language": {
        "url": "../../assets/js/dataTables.zh.json"
      }
    });

    // 初始化模型性能趋势图
    var performanceCtx = document.getElementById('modelPerformanceChart').getContext('2d');
    var performanceChart = new Chart(performanceCtx, {
      type: 'line',
      data: {
        labels: ['1月', '2月', '3月', '4月', '5月', '6月'],
        datasets: [{
          label: '准确率',
          data: [92, 93, 94, 95, 95.5, 95.8],
          borderColor: 'rgb(75, 192, 192)',
          tension: 0.1
        }]
      },
      options: {
        responsive: true,
        maintainAspectRatio: false
      }
    });

    // 初始化模型资源使用图
    var resourceCtx = document.getElementById('modelResourceChart').getContext('2d');
    var resourceChart = new Chart(resourceCtx, {
      type: 'bar',
      data: {
        labels: ['CPU使用率', '内存使用率', 'GPU使用率'],
        datasets: [{
          label: '使用率',
          data: [45, 60, 30],
          backgroundColor: [
            'rgba(255, 99, 132, 0.2)',
            'rgba(54, 162, 235, 0.2)',
            'rgba(255, 206, 86, 0.2)'
          ],
          borderColor: [
            'rgba(255, 99, 132, 1)',
            'rgba(54, 162, 235, 1)',
            'rgba(255, 206, 86, 1)'
          ],
          borderWidth: 1
        }]
      },
      options: {
        responsive: true,
        maintainAspectRatio: false,
        scales: {
          y: {
            beginAtZero: true,
            max: 100
          }
        }
      }
    });
  });
</script>
</body>
</html> 